Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		Super.OnCreate()
				
		DISPLAY.SetVirtualSize(320,480)
		
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		Return 0
	End

End


Class btn_1_press Extends TCallback

	Field b:TGUIButton

	Method New(obj:TGUIButton)
		Self.b = obj
	End

	Method Call:Void()
		Print("AKT_BUTTON_1")
		
	End

End

Class btn_2_press Extends TCallback

	Field b:TGUIButton

	Method New(obj:TGUIButton)
		Self.b = obj
	End

	Method Call:Void()
		Print("AKT_BUTTON_2")
		
	End

End


Class btn_3_press Extends TCallback

	Field b:TGUIButton

	Method New(obj:TGUIButton)
		Self.b = obj
	End

	Method Call:Void()
		
		Print("AKT_BUTTON_3")
	End

End

Class TTmpScreen Extends TScreen
	
	Field btn_activity_1:TGUIButton
	Field btn_activity_2:TGUIButton
	Field btn_activity_3:TGUIButton

	' START when app is created
	Method Start:Void()
	
		IMAGES.LoadAnim("agfx_gui_button2.png",64,48,3,null,False)
		
		Self.btn_activity_1 = New TGUIButton("BTN_1","agfx_gui_button2",100,100,False)
		Self.btn_activity_1.OnHit = New btn_1_press(Self.btn_activity_1)
		
		Self.btn_activity_2 = New TGUIButton("BTN_2","agfx_gui_button2",100,148,False)
		Self.btn_activity_2.OnHit = New btn_2_press(Self.btn_activity_2)
		
		Self.btn_activity_3 = New TGUIButton("BTN_3","agfx_gui_button2",100,196,False)
		Self.btn_activity_3.OnHit = New btn_3_press(Self.btn_activity_3)
		
	End
	
	' main app logic loop update
	Method Update:Void()
		
		Self.btn_activity_1.Update()
		Self.btn_activity_2.Update()
		Self.btn_activity_3.Update()
	End
	
	' main app render loop
	Method Render:Void()
		Cls
		Self.btn_activity_1.Draw()
		Self.btn_activity_2.Draw()
		Self.btn_activity_3.Draw()
	End
End
